/*
 * @Author: zhouyan
 * @Date: 2023-07-14 17:17:04
 * @LastEditors: zhouyan
 * @LastEditTime: 2023-07-14 20:05:49
 * @FilePath: /owe-ui/js/common.js
 * @Description: 
 * 
 */

// 点击菜单跳转页面
$('.menu-wrap').on("click",".menu",function () {
    console.log($(this).hasClass("active"))
    var isActive = $(this).hasClass("active");
    var index = $(this).index();
    if(!isActive) {
        switch (index) {
            case 0:
                location.href = "./../index.html";
                break;
            case 1:
                location.href = "./news.html";
                break;
            case 2:
                location.href = "./about.html";
                break;


        }
    }
})


var topHeight=$(".top").height(); 

/*滚动事件 */
$(window).scroll(function() { 
    console.log($(window).scrollTop(),topHeight);
    if($(window).scrollTop()>=topHeight-10){ //滚动条距离顶部大于某高度(整个页面的百分之二十)
         $("header").addClass('header-fixed') //设置菜单栏的固定属性
     }else{
        $("header").removeClass('header-fixed') //设置菜单栏的固定属性
    }
    })
